/***********************
   Party Sense Arduino Project
   
   Arjun Sinha
   Rajeev Krithivasan
   Will Sergeant
***********************/

int counter = 0;
int incomingByte;
String s[100];
int songno=0;

class song{
  String songName;
  String deviceName[10];
  String artist;
  int count;
}

void setup() {
  Serial.begin(115200);
  for(int i=0;i<100;i++) s[i]="";
}


void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it's a capital R, reset the counter
    
    //Serial.println(incomingByte);
    if (incomingByte == 'R') {
      songno=0;
      counter=0;
    }
    
    else if(incomingByte==(byte)13){
      songno++;
      Serial.print("Number of songs=");
      Serial.println(songno);
      Serial.println("Current song list:");
      for(int i=0;i<songno;i++){
        //Serial.print(i);
        //Serial.print(":");
        Serial.println(s[i]);  
      }
    }
    

    s[songno] = s[songno]+(byte)incomingByte;
    
  }
  
  counter++;
  
  delay(250);
}
